package com.baitiaojun.api.domain.video;

import com.baitiaojun.api.domain.user.UserInfo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;
import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@ApiModel("视频评论")
@Document(indexName = "video_comment")
public class VideoComment{

    @Id
    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(value = "一级评论id", readOnly = true)
    private Long id;

    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(value = "视频id", required = true)
    @Field(type = FieldType.Long)
    private Long videoId;

    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(hidden = true)
    @Field(type = FieldType.Long)
    private Long userId;

    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(hidden = true)
    @Field(type = FieldType.Long)
    private Long replyUserId;

    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(value = "回复的一级评论id")
    @Field(type = FieldType.Long)
    private Long rootId;

    @ApiModelProperty(hidden = true)
    @Field(type = FieldType.Date, index = false)
    private Date createTime;

    @ApiModelProperty(hidden = true)
    @Field(type = FieldType.Date, index = false)
    private Date updatetime;

    @ApiModelProperty(value = "评论内容")
    @Field(type = FieldType.Text, index = false)
    private String comment;

    @ApiModelProperty(hidden = true)
    @Field(type = FieldType.Object, index = false)
    private List<VideoChildComment> videoChildComments;

    @ApiModelProperty(hidden = true)
    @Field(type = FieldType.Object, index = false)
    private UserInfo userInfo;

    @ApiModelProperty(hidden = true)
    @Field(type = FieldType.Object, index = false)
    private UserInfo replyUserInfo;

    @ApiModelProperty(hidden = true)
    @Field(type = FieldType.Integer, index = false)
    private Integer count;
}